package com.food.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.food.pojo.Admin;
import com.food.result.Result;
import com.food.service.AdminService;
import com.food.service.DistinguishService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@CrossOrigin(origins = "*")
@Api(tags = "智能识图")
@RestController
@RequestMapping("/api/Distinguish")
public class DistinguishController {

    @Autowired
    private DistinguishService distinguishService;

    //    添加角色
    @ApiOperation(value = "识别图片")
    @PostMapping(value = "/file")
    public Result save(@RequestPart("file") MultipartFile file) throws Exception {
        String distinguish = this.distinguishService.getDistinguishService(file);
        if(distinguish!=null){

            return Result.ok(distinguish);
        }else {
            return Result.fail("识别不成功");
        }

    }


}